package yl.hs.bmipfull.daos.finance;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import yl.hs.bmipfull.daos.BaseDao;
import yl.hs.bmipfull.pojo.finance.BrickShipSettleMainEntity;
import yl.hs.bmipfull.pojo.finance.ContractAmount;
import yl.hs.bmipfull.pojo.production.BrickShipOrderModel;
import yl.hs.bmipfull.pojo.salemanage.SaleContractEntity;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/*
 * IBrickShipSettleMainDao
 * @category
 * @author 谢景广
 * @date 2023-01-03
 */
@Repository
public interface IBrickShipSettleMainDao extends BaseDao<BrickShipSettleMainEntity> {
    Integer deleteBySettleSN(@Param("settleSN") String settleSN);

    Integer changeOrderDetailToUnSettleByOrderSN(@Param("snList") List<String> snList);
    Integer changeOrderMainToUnSettleByOrderSN(@Param("snList") List<String> snList);

    int queryCountByCondition(@Param("map")Map<String, Object> query, List<Map<String, Object>> filters);

    List<BrickShipSettleMainEntity> queryPage(@Param("map")Map<String, Object> query, List<Map<String, Object>> filters);

    List<SaleContractEntity> querySettleContract(@Param("map")Map<String, Object> searchQuery, List<Map<String, Object>> filters);

    List<BrickShipOrderModel> queryTempSettleOrders(@Param("map")Map<String, Object> searchQuery, List<Map<String, Object>> filters);

    List<BrickShipSettleMainEntity> queryContractSettleLast(@Param("map")Map<String, Object> searchQuery, List<Map<String, Object>> filters);

    List<ContractAmount> queryContractReceiptList(@Param("map")Map<String, Object> searchQuery, List<Map<String, Object>> filters);

    List<BrickShipOrderModel> querySettleOrdersBySettleSN(String settleSN);

    List<BrickShipOrderModel> querySettleOrdersBySnArray(String[] snArray);

    BrickShipSettleMainEntity getLastSettle(String contractSN);

    Integer changeOrderDetailToSettled(ArrayList<String> snList);

    Integer changeOrderMainToSettled(ArrayList<String> snList);

    List<BrickShipOrderModel> brickSaleStatistics(@Param("map") Map<String, Object> map);

    int brickCountCars(@Param("map") Map<String, Object> map);

    List<BrickShipOrderModel> queryGroupByProductSN(@Param("map") Map<String, Object> map, @Param("filters") List<Map<String,Object>> filters, List<Integer> states);

    BrickShipSettleMainEntity LastBrickSettle(String contractSn);
}
